<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;

use App\Models\MovieBaseInfo;
use QL\QueryList;
class RequestMoviePageJobs implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
    protected $movie;
    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct(MovieBaseInfo $movie)
    {
        $this->movie = $movie;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        $r = QueryList::get(config('services.oss.douban.url') . '/' . $this->movie->douban_id, null, [
            'timeout' => 3
        ]);
        if ($r) {
            dispatch(new CrawlerMovieJobs($this->movie->douban_id));
        }
    }
}
